#include<stdio.h>
int main()
{
    char ch;
    int num=0;
    ch=getchar();
    while(ch!='\n')
    {
        switch(ch)
        {
            case '1':num+=num*2+1;break;
            case '0':num+=num*2+0;break;
            default :printf("Error Input!\n");
            return 0;
        }
        ch=getchar();
    }
     printf("%d",num);
    return 0;

}
